package com.vision.mapper;

import com.vision.pojo.entity.LikeComment;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LikeCommentMapper {
    /**
     * 添加点赞评论记录
     * @param userId 用户ID
     * @param commentId 评论ID
     */
    @Insert("insert into vs_like_comment (user_id,comment_id,create_time) values (#{userId},#{commentId},now())")
    void insert(Integer userId, Integer commentId);

    /**
     * 删除点赞评论记录
     * @param commentList 评论ID
     */
    void deleteLikeCommentByCommentIds(List<Integer> commentList);

    /**
     * 删除点赞评论记录
     * @param userId 用户ID
     * @param commentId 评论ID
     */
    @Delete("delete from vs_like_comment where user_id = #{userId} and comment_id = #{commentId}")
    void deleteByUserIdAndCommentId(Integer userId, Integer commentId);

    /**
     * 查询点赞评论记录
     * @param userId 用户ID
     * @param commentId 评论ID
     * @return LikeComment
     */
    @Select("select * from vs_like_comment where user_id = #{userId} and comment_id = #{commentId}")
    LikeComment selectByUserIdAndCommentId(Integer userId, Integer commentId);
}
